package live.testdemo.bazi.common.constants;

import java.util.Arrays;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 计算旺度
 *
 * @author zhoujianxin
 * @desc todo
 * @date 2023/1/26 20:22.
 */
@Getter
@AllArgsConstructor
public enum WangDu {
    弱极(0.0, 0.8),
    太弱(0.8, 2.4),
    比弱(2.4, 4.0),
    较弱(4.0, 5.7),
    偏弱(5.7, 8.8),
    中和(8.8, 11.2),
    偏旺(11.2, 13.7),
    较旺(13.7, 20.0),
    比旺(20.0, 26.0),
    太旺(26.0, 36.0),
    旺极(36.0, 1000.0),
    ;
    private double min;
    private double max;

    public static WangDu getWangDu(double wangDuValue) {
        return Arrays.stream(WangDu.values()).filter(x -> wangDuValue > x.getMin() && wangDuValue < x.getMax())
                .findFirst().get();
    }
}
